package com.chixing.controller;

import com.alibaba.fastjson2.JSON;
import com.chixing.commons.ServerResponse;
import com.chixing.pojo.EducationalExperience;
import com.chixing.pojo.Myresume;
import com.chixing.service.IEducationalExperienceService;
import com.chixing.service.impl.EducationalExperienceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * <p>
 * 教育经历表 前端控制器
 * </p>
 *
 * @author Jason Marslyon
 * @since 2022-10-04
 */
@RestController
@RequestMapping("edu")
public class EducationalExperienceController{

    @Autowired
    IEducationalExperienceService iEducationalExperienceService;

    //    通过mresumeId获取educationalExperience表信息，并返回
    @RequestMapping("/getResumeId")
    public ServerResponse getEduByMyresumeId(@RequestParam("resumeId") Integer resumeId){
        EducationalExperience edu = iEducationalExperienceService.getEduById(resumeId);
        return ServerResponse.success("成功",edu);

    }
    //更新myresume表
    @RequestMapping("updateEducational/{myResumeId}")
    public ServerResponse updateEducational(EducationalExperience experience, @PathVariable("myResumeId") Integer myResumeId){
        System.out.println("=====更新myresume表===============");
        ServerResponse serverResponse =iEducationalExperienceService.updateEducational(experience,myResumeId);
        return serverResponse;
    }


}
